package com.example.spring_secutity.controller;


import com.example.spring_secutity.util.Result;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author zz
 * @since 2024-07-11
 */
@Controller
@RequestMapping("/right")
public class RightController {
    @RequestMapping("/L0301")
    @ResponseBody
    public Result l0301(){
        Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
        System.out.println(authentication.getPrincipal());
        System.out.println(authentication.getAuthorities());
        System.out.println(authentication.getCredentials());
        System.out.println(authentication.getDetails());

        return Result.ok(authentication.getAuthorities()).message("服务创建");
        //return "服务创建";
    }

    @RequestMapping("/L0302")
    @ResponseBody
    public String l0302(){
        return "服务分配";
    }


    @RequestMapping("/L0303")
    @ResponseBody
    public String l0303(){
        return "服务处理";
    }
}
